<template>
  <div class="knife">
    <DFPageList ref="dfPageListRef" :page-options="pageOptions" />
  </div>
</template>

<script lang="ts" setup name="Knife">
  import { ref } from 'vue';
  import lang from './lang';
  import { addKnife, delKnife, pageKnife, updateKnife } from '@/api/base/knife';
  import { useMixins } from '@/hooks/useMixins';

  const { loadLangFn } = useMixins();

  const dfPageListRef: any = ref(null);

  loadLangFn(lang);

  const pageOptions = {
    searchForm: {
      formSchemas: [
        {
          label: 'knifeName',
        },
        {
          label: 'knifeCode',
        },
      ],
    },
    table: {
      columns: [
        {
          width: 120,
          label: 'knifeName',
        },
        {
          width: 120,
          label: 'knifeCode',
        },
        {
          width: 120,
          label: 'remark',
          common: true,
        },
      ],
      action: {
        columns: [
          {
            label: 'edit',
          },
          {
            label: 'delete',
          },
        ],
      },
      operaColumn: [
        {
          label: 'add',
        },
      ],
      requestFn: pageKnife,
      delRequestFn: delKnife,
    },
    modalFormDialog: {
      formSchemas: [
        {
          label: 'knifeName',
          required: true,
        },
        {
          label: 'knifeCode',
          required: true,
          editDialogDisabled:true
        },
        {
          label: 'remark',
          common: true,
          type: 'textarea',
        },
      ],
      addDataFn: addKnife,
      updateDataFn: updateKnife,
    },
  };
</script>
